package com.example.juc.big_talk_concurrent.chapter2.article8;

public class Test {
    volatile int a = 0;
    volatile boolean flag = true;
    // 线程 A
    public void write() {
        a = 1;
        flag = true;
    }

    // 线程 B
    public void read() {
        if (flag) {
            int i = a;
        }
    }
}
